package innersort;

/*
 * 冒泡排序
 * */
public class BubbleSort extends BaseSort {
    public static void main(String[] args) {
        int[] array = {2, 23, 25, 35, 1, 7, 9, 22, 25, 23, 16, 28, 30};
        sort(array);
    }

    public static void sort(int[] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[j] < array[j - 1]) {
                    exchange(array, j, j - 1);
                }
                print(array, j, j - 1);
            }
        }
    }
}
